<?php
/**
* @author Bimal Poudel
* @copyright since 2006, Bimal Poudel
* @package Smarty Framework
* @support http://www.odesk.com/users/~~dd91d11caed0cdce
* @contact http://www.sanjaal.com
* @company Sanjaal Corps
*/

# Created on: 2011-03-26 02:03:52 890

/**
* Delete an entity in [ posts ]
* Our policy is to reset the is_active flag to N (no) to mean a deletion.
* A record is NOT deleted physically.
*/

# If you do not allow the delete feature, just enable the below line.
# stopper::url('posts-list.php');

$posts = new posts();

# Assumes, ID always, in the GET parameter
if(($post_id = $variable->get('id', 'integer', 0)) && ($code=$variable->get('code', 'string', '')))
{
	if($posts->delete('inactivate', $post_id, $code))
	{
		$messenger = new messenger('warning', 'The record has been deleted.');
		
		#stopper::url('posts-delete-successful.php');
		stopper::url('posts-list.php');
	}
	else
	{
		$messenger = new messenger('error', 'The record has NOT been deleted.');

		stopper::url('posts-delete-error.php');
	}
}
else
{
	stopper::url('posts-direct-access-error.php');
}
?>